//JavaScript Framework 2.0 Code
try{
Type.registerNamespace('com.yonyou.ncmm_pac_pda.ProcessCompleteRptController');
com.yonyou.ncmm_pac_pda.ProcessCompleteRptController = function() {
    com.yonyou.ncmm_pac_pda.ProcessCompleteRptController.initializeBase(this);
    this.initialize();
}
com.yonyou.ncmm_pac_pda.ProcessCompleteRptController.currentQueryCondition=null;
function com$yonyou$ncmm_pac_pda$ProcessCompleteRptController$initialize(){
    //you can programing by $ctx API
    //get the context data through $ctx.get()
    //set the context data through $ctx.push(json)
    //set the field of the context through $ctx.put(fieldName, fieldValue)
    //get the parameter of the context through $ctx.param(parameterName)
    //Demo Code:
    //    var str = $ctx.getString();      //获取当前Context对应的字符串
    //    alert($ctx.getString())          //alert当前Context对应的字符串
    //    var json = $ctx.getJSONObject(); //获取当前Context，返回值为json
    //    json["x"] = "a";        //为当前json增加字段
    //    json["y"] = [];           //为当前json增加数组
    //    $ctx.push(json);            //设置context，并自动调用数据绑定
    //    
    //    put方法需手动调用databind()
    //    var x = $ctx.get("x");    //获取x字段值
    //    $ctx.put("x", "b");     //设置x字段值
    //    $ctx.put("x", "b");     //设置x字段值
    //    $ctx.databind();            //调用数据绑定才能将修改的字段绑定到控件上
    //    var p1 = $param.getString("p1");   //获取参数p2的值，返回一个字符串
    //    var p2 = $param.getJSONObject("p2");   //获取参数p3的值，返回一个JSON对象
    //    var p3 = $param.getJSONArray("p3");   //获取参数p1的值，返回一个数组
    $ctx.setApp({
        "index":1,
    });
    //your initialize code below...
}
    
function com$yonyou$ncmm_pac_pda$ProcessCompleteRptController$evaljs(js){
    eval(js)
}
function com$yonyou$ncmm_pac_pda$ProcessCompleteRptController$viewPage0_onload(sender, args){
	NCMMPubUtil.createTable(SrcOrderVO);
	//$alert("建表完成");
}
//togglebutton0
function com$yonyou$ncmm_pac_pda$ProcessCompleteRptController$togglebutton0_onclick(sender, args){
	var index = $ctx.getApp("index")+1;
			$ctx.setApp({
                "index":index
            });    
          //  $alert(index);
    var order = {
    	"orderid":index,
    	"material":"material"+index,
    	"producenum":100,
    	"completenum":200
    }
	NCMMPubUtil.insertVO(SrcOrderVO,order);
	//$alert("INSERT COMPLETE");
	reloaddata();
	//$alert($ctx.getJSONObject());
}
function com$yonyou$ncmm_pac_pda$ProcessCompleteRptController$imagebutton0_onclick(sender, args){

}

function com$yonyou$ncmm_pac_pda$ProcessCompleteRptController$listviewdefine0_onitemclick(sender, args){
	var row = $id("listviewdefine0").get("row");
	//$alert(row);
	$view.open({
        "viewid": "com.yonyou.ncmm_pac_pda.ProcessRptDetail",//目标页面（首字母大写）全名
        "isKeep": "true",//打开新页面的同时是否保留当前页面，true为保留，false为不保留
        "row":row
    })
}

function com$yonyou$ncmm_pac_pda$ProcessCompleteRptController$button2_onclick(sender, args){
	var row = $id("listviewdefine0").get("row");
	//$alert(row);
	$view.open({
        "viewid": "com.yonyou.ncmm_pac_pda.ProcessRptCardEdit",//目标页面（首字母大写）全名
        "isKeep": "true",//打开新页面的同时是否保留当前页面，true为保留，false为不保留
        "row":row,

    })
}

function reloaddata(){
	NCMMPubUtil.queryVO(SrcOrderVO,null,function(data){
		var json={listdata:data};
		$ctx.push(json);
	});
}
com.yonyou.ncmm_pac_pda.ProcessCompleteRptController.prototype = {
    button2_onclick : com$yonyou$ncmm_pac_pda$ProcessCompleteRptController$button2_onclick,
	listviewdefine0_onitemclick : com$yonyou$ncmm_pac_pda$ProcessCompleteRptController$listviewdefine0_onitemclick,
    imagebutton0_onclick : com$yonyou$ncmm_pac_pda$ProcessCompleteRptController$imagebutton0_onclick,
    togglebutton0_onclick : com$yonyou$ncmm_pac_pda$ProcessCompleteRptController$togglebutton0_onclick,
    viewPage0_onload : com$yonyou$ncmm_pac_pda$ProcessCompleteRptController$viewPage0_onload,
    initialize : com$yonyou$ncmm_pac_pda$ProcessCompleteRptController$initialize,
    evaljs : com$yonyou$ncmm_pac_pda$ProcessCompleteRptController$evaljs
};
com.yonyou.ncmm_pac_pda.ProcessCompleteRptController.registerClass('com.yonyou.ncmm_pac_pda.ProcessCompleteRptController',UMP.UI.Mvc.Controller);
}catch(e){$e(e);}
